#!/usr/bin/env node

const Koa = require('koa'),
  koaBody = require('koa-body'),
  Router = require('koa-router');
let path = require('path');
const app = new Koa();
app.use(koaBody({
  multipart: true,
  formidable: {
    uploadDir: path.join(__dirname, '/testFileCommit'),//上传的文件放入testFileCommit文件夹下
    keepExtendsions: true
  }
}));
let router = new Router();
router.post('/file', async (ctx, next) => {
  const file = ctx.request.files;
  console.log(file);
  ctx.body = { path: file }
})
app.use(router.routes())
app.listen(3000);
